﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Part3_IndividuleAssignment2.ViewModels;
using Part3_IndividuleAssignment2.Models;
using WebApiContrib.Formatting;

namespace Part3_IndividuleAssignment2.Controllers
{
    public class CreateNewAccountController : ApiController
    {
        public HttpResponseMessage Post(NewAccount newAccount)
        {
            if (ModelState.IsValid)
                return (new NewsSystemRepository()).CreateNewAccount(newAccount, Request);
            else
                return Request.CreateResponse(HttpStatusCode.BadRequest, "Invalid request.");
               
        }
    }
}
